import {onMounted, reactive} from 'vue'
import axios from 'axios';


export default function(){
    //data
    let dogList = reactive([
        'https://images.dog.ceo/breeds/pembroke/n02113023_4373.jpg'
    ])
    //methods
    async function getDog(){
        let result = await axios.get('https://images.dog.ceo/api/breeds/pembroke/images/radiom')
        dogList.push(result.data.message)
    }
    //钩子
    onMounted(()=>{
        getDog()
    })
    //向外部提供东西
    return {dogList,getDog}
}
